package com.archgeek.rpc.thrfit.impl;

import com.archgeek.rpc.thrfit.gen.StudentService;
import org.apache.thrift.TException;

import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * @author pizhihui
 * @date 2022-04-07 10:09
 */
public class StudentServiceImpl implements StudentService.Iface {

    private Random random = new Random();

    @Override
    public String sayHello(String params) throws TException {
        System.out.println("打印参数了......" + params);
        int i = random.nextInt(12);
        try {
            TimeUnit.SECONDS.sleep(i);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "返回参数...." + params + ",睡了多久: " + i + "s";
    }
}
